import { ZFormItemSchema } from "@/components/Form/typings";
import { imageRender } from "@/components/Table/helpers/renders";
import { ZTableColumn } from "@/components/Table/typings";
import { dateFormat } from "@/utils/date";

export const getColumns = (): ZTableColumn[] => [
  {
    title: "Id(测试用)",
    key: "id",
  },
  {
    title: "Avatar",
    key: "avatar",
    render({ rowData }: any) {
      return imageRender(rowData.avatar?.path);
    },
  },
  {
    title: "Name",
    key: "name",
  },
  {
    title: "Number",
    key: "num",
    sorter: true,
  },
  {
    title: "Address",
    key: "address",
  },
  {
    title: "CreatedAt",
    key: "createdAt",
    render({ rowData }: any) {
      return <span>{dateFormat(rowData.createdAt)}</span>;
    },
    sorter: true,
  },
];

export const getSearchSchemas = (): ZFormItemSchema[] => [
  {
    label: "姓名",
    path: "name",
    span: 12,
  },
];
